package com.example.finalssm.Controller;

import com.example.finalssm.mapper.IntegrateMapper;
import com.example.finalssm.pojo.Integrate;
import com.example.finalssm.utils.JsonUtils;
import com.example.finalssm.utils.MybatisUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Controller
@RequestMapping("/blogger")
public class IntegrateController {
    @RequestMapping("/selectAll")
    //通过前端传过开的用户id来找到他所有的问题回答评论
    public String SelectAllAsIntegrate(@RequestParam("userId") int id) {
        List<Integrate> integrates = MybatisUtils.getSqlSession().getMapper(IntegrateMapper.class).selectAll(id);
        //再把查询结果返回前端;
        return JsonUtils.getJson(integrates);
    }
}
